home *** CD-ROM | disk | FTP | other *** search
- /*//////////////////////////////////////////////////////////////////////
- filename: conditions.js
- copyright(c): Tiny Software cortp 2002, 2003 (http://www.tinysoftware.com)
- author: Jozef Palocko (jpalocko@tinysoftware.com)
- product: Tiny Personal Firewall 5.x
- description: implemetation of Global conditions HTML code
- ///////////////////////////////////////////////////////////////////////*/
-
- //main function
-
-
- //return conditions string as HTMLcode
- function GetConditionsHtml(strFile)
- {
- var strConditions = "";
-
- var xmlDoc = LoadDOM (strFile);
-
- // Query a node-set.
- var oNodes = xmlDoc.selectNodes('//Condition[@Type = "Global"]');
- for (i=0; i<oNodes.length; i++)
- {
- oNode = oNodes.nextNode;
- if (oNode != null)
- {
- strConditions += GetCheckBoxHtml(oNode.nodeName, oNode.text, 0) + "<br>";
- }
- }
-
- return strConditions;
- }
-
- //return string with Checkbox tag HTML code
- function GetCheckBoxHtml(strName, strText, bSelected)
- {
- Val ="";
- if (bSelected)
- Val = "CHECKED";
- return '<input type="checkbox" '+ Val + ' name="' + strName + '">' + strText ;
- }
-
- //load XML document
- function LoadDOM(strFile)
- {
- var dom;
- try
- {
- dom = new ActiveXObject("MSXML2.DOMDocument.4.0");
- dom.async = false;
- dom.validateOnParse = false;
- dom.resolveExternals = false;
- dom.load(strFile);
- }
- catch (e)
- {
- alert(e.description);
- }
- return dom;
- }
-